using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace Shuriken.Core.UI.StandardUI
{
    public class ctrlItemListBox : System.Windows.Forms.ListBox 
    {
        protected override void OnMeasureItem(System.Windows.Forms.MeasureItemEventArgs e)
        {
            e.ItemHeight = 40;
            e.ItemWidth = 300; 
        }

        protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e)
        {
            e.DrawBackground();

            if (Items.Count > 0)
            {
                Core.Store.ISearchable item = (Core.Store.ISearchable)Items[e.Index];
                Font titleFont = new Font(this.Font, FontStyle.Bold);

                Store.ImageStore.DrawImage(e.Graphics, e.Bounds.X + 15, e.Bounds.Y + 4, item.Icon);
                
                e.Graphics.DrawString(item.Name, titleFont, new SolidBrush(Color.Black), e.Bounds.X + 15 + 32 + 2, e.Bounds.Y + 8);
                e.Graphics.DrawString(item.Description, this.Font, new SolidBrush(Color.Gray), e.Bounds.X + 15 + 32 + 2, e.Bounds.Y + 8 + titleFont.SizeInPoints + 4);
            }
        }

        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // ctrlItemListBox
            // 
            this.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
            this.Size = new System.Drawing.Size(120, 95);
            this.ResumeLayout(false);
        }
    }
}
